import java.util.Scanner;

//实现验证登录，有三次机会，如果用户名为“丁真”，密码“666”提示登录成功，否则提示还有几次机会
public class BreakExercise02 {
    public static void main(String[] args) {
        String admin = "丁真";
        String passward = "666";
        Scanner scanner = new Scanner(System.in);
        for (int i = 5; i >= 1; i--) {
            System.out.println("请输入账号：");
            String adminInput = scanner.next();
            System.out.println("请输入密码：");
            String passwardInput = scanner.next();
            if (adminInput.equals(admin) && passwardInput.equals(passward)) {
                System.out.println("登录成功！");
                break;
            } else {
                System.out.println("登录失败！还剩" + i + "次机会");
            }
        }
    }
}
